Analyzing the DSDT DSL
By looking at the DSL file, we find the registers we are interested in:
OperationRegion (ECRM, EmbeddedControl, 0x00, 0xFF) Field (ECRM, ByteAcc, NoLock, Preserve) { [...] Offset (0xD1), BTY, 32, MFAC, 8, CFAN, 8, PFAN, 8, [...] }
Calculating the register addresses
We calculate the register addresses as follows:
- CFAN = Offset(0xD1) + ((32 + 8) / 8) = 0xD6 = 214
- PFAN = Offset(0xD1) + ((32 + 8 + 8) / 8) = 0xD7 = 215
Finding the WriteRegister
We use the probing tool to find out which register controls the fan:
sudo ec_probe write 214 0
sudo ec_probe write 214 20
sudo ec_probe write 214 50
Nothing has happened here
sudo ec_probe write 215 0
sudo ec_probe write 215 20
sudo ec_probe write 215 50
The fan changed its speed
Result: PFAN is the WriteRegister, CFAN is the ReadRegister
Finding the ReadRegister values
We ensure that the fan is turned off (or at least at the minimum speed).
sudo ec_probe read 214
Output: 20
We run stress -c 8
to stress the system and spin up the fan.
sudo ec_probe read 214
Output: 90
Result: 20 is the MinSpeedValue and 90 is the MaxSpeedValue
Finding the WriteRegister values
We use the probing tool to find the values that stop the fan and set the fan to full speed:
sudo ec_probe write 215 0
sudo ec_probe write 215 10
[...]
sudo ec_probe write 215 255
We see that:
- 0 stops the fan
- 20 starts the fan at minimum speed
- 90 sets the fan to maximum speed
Writing the configuration file
- 214 (CFAN) is the ReadRegister.
- 215 (PFAN) is the WriteRegister.
- 20 is the MinSpeedValue.
- 90 is the MaxSpeedValue.
- 0 is a special case. This will be handled by FanSpeedPercentageOverrides.
- IndependentReadMinMaxValues is false, since CFAN and PFAN share the same range.
See the configuration file on GitHub